<%--
  Created by IntelliJ IDEA.
  User: vx
  Date: 12/4/13
  Time: 7:28 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>vxBug</title>
    <link rel="shortcut icon" type="image/x-icon" href="<c:out value="${pageContext.request.contextPath}" />/resources/favicon.ico" />
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
    <link rel="stylesheet" href="quarcum.dyndns.org:8087/resources/css/main.css">
</head>
<body>
<%@ include file="header_login.jsp" %>


<div class="container">

    <div class="jumbotron">
        <ol class="breadcrumb">
            <li><a href="http://quarcum.dyndns.org:8087/">Hub</a></li>
            <li><a href="http://quarcum.dyndns.org:8087/vxBug/">vxBug</a></li>
            <li><a href="http://quarcum.dyndns.org:8087/vxBug/program/${p.id}">Buglist for ${p.name}</a></li>
            <li class="active">Bug #${b.id}</li>
            <!--
            <li><a href="#">Library</a></li>
            <li class="active">Data</li> -->
        </ol>

<div class="panel panel-default">   <div class="panel-body">${p.name} v.${b.programVersionWithBug} : bug#${b.id} - ${b.bugTitle}<br />
Status: ${b.status}<br />
Priority: ${b.priority}<br />
Opener: ${b.openerUserName}<br />
Added on: ${b.date}<br />
    <c:if test="${b.programVersionFixed != null}">
Fixed in: ${p.name} v.${b.programVersionFixed}
        </c:if></div> </div>
<div class="panel panel-default">   <div class="panel-body">Description: ${b.bugInfo}</div> </div>

<security:authorize ifAllGranted="ROLE_ADMIN">
    <div class="panel panel-default">
        <div class="panel-body">
    <form method="POST" action="<c:url value="/program/${p.id}/bug/${b.id}/changeStatus" />" >
        <c:out value="${p.name}" /> Version fixed
        <br />
            <input type="text" name="programVersionFixed" /><br />
            Change status
        <br />
        <select name="status">
            <c:forEach items="${statuses}" var="s">
                <option value="${s}">
                    <c:out value="${s}" />
                </option>
            </c:forEach>
        </select><br />
        <input type="submit" value="Change bug status" />
    </form>
        </div>
    </div>
</security:authorize>
    </div> <!-- /jubmotron -->
    <div class="jumbotron">
<h2>Comments:</h2>

        <ul class="media-list">
            <c:forEach items="${comments}" var="c">
            <li class="media">
                <a class="pull-left" href="#">
                    <img class="media-object" src="http://quarcum.dyndns.org:8087/vxBug/resources/default-user.png">
                </a>
                <div class="media-body">
                    <h4 class="media-heading"><c:forEach items="${users}" var="u">
                        <c:if test="${u.id == c.commenterUserId}">
                            <c:out value="${u.name}" />
                        </c:if>
                    </c:forEach> on ${c.date}</h4>
                        ${c.commentString}
                </div>
            </li>
            </c:forEach>
        </ul>
        <div class="panel panel-default">
            <div class="panel-body">
                <form method="POST" action="<c:url value="/program/${p.id}/bug/${b.id}/addComment" />" >

                    <input type="hidden" name="bugId" value="${b.id}" />
                    <security:authentication property="name" var="username"/>
                    <input type="hidden" name="userLogin" value="${username}" />
                    Comment on this bug
                    <br />
                    <textarea name="commentString" cols="50" rows="3"></textarea><br>
                    <br />

                    <input type="submit" value="Submit" /> <h6><font color="grey">Programmer will be notified about your comments</font></h6>
                </form>
            </div>
        </div>
    </div> <!-- /jubmotron -->
</div> <!-- /container -->
</body>
</html>